<template>
	<view class="content">
		<!-- 成员信息 -->
		<view class="teamContent" v-if="type == 1">
			<view class="teamContent-title-content">
				<view>分享</view>
				<view class="span">个人消费</view>
			</view>
			<!-- 成员列表 -->
			<view class="teamList">
				<view class="list" v-for="(item,index) in list" :key="index">
				<view class="userHeader">
					<image :src="item.avatar" class="hearder"></image>
					<image src="@/static/member/image12.png" class='memberVipIcon' v-if='item.isMember==0' mode="">
					</image>
					<image src="@/static/member/image13.png" class='memberVipIcon' v-if='item.isMember==1' mode="">
					</image>
					<image src="@/static/member/image14.png" class='memberVipIcon' v-if='item.isMember==2' mode="">
					</image>
				</view>
				<view>
					<view class="userInfoBox">
						<view class="tj_user">
							{{item.userName||'未命名'}}
						</view>
						<view :class="[item.todayHaveBuy=='0'?'todayHaveBuy1':'todayHaveBuy']">
							{{item.todayHaveBuy=='0'?'未参拍':'已参拍'}}
						</view>
					</view>
					<view class="tj_name">
						 <span>ID:{{item.userId}}</span>
					</view>
				
					<!-- <image src="@/static/bet/vip1.png" class="vip-img" v-if="item.level == 1"></image>
					<image src="@/static/bet/vip2.png" class="vip-img" v-if="item.level == 2"></image>
					<image src="@/static/bet/vip3.png" class="vip-img" v-if="item.level == 3"></image> -->
					<image src="@/static/member/image6.png" v-if='item.trueLevel==0' class='vip-img' mode="">
					</image>
					<image src="@/static/member/image7.png" v-if='item.trueLevel==1' class='vip-img' mode="">
					</image>
					<image src="@/static/member/image8.png" v-if='item.trueLevel==2' class='vip-img' mode="">
					</image>
					<image src="@/static/member/image5.png" v-if='item.trueLevel==3' class='vip-img' mode="">
					</image>
				
					<image src="@/static/member/image2.png" v-if='item.groupLevel==0' class='vip-img' mode="">
					</image>
					<image src="@/static/member/image3.png" v-if='item.groupLevel==1' class='vip-img' mode="">
					</image>
					<image src="@/static/member/image4.png" v-if='item.groupLevel==2' class='vip-img' mode="">
					</image>
					<image src="@/static/member/image11.png" v-if='item.groupLevel>=3' class='vip-img' mode="">
					</image>
				
				</view>
				
				<view class="next"><span>{{jinwei(item.personalBuy)}}</span></view>
				<!-- <view class="tell" @click='makePhoneCall(item.phone)'>
					<image src="@/static/statc-icon/tell-phone.png"
						style='width: 36rpx;height: 36rpx;margin-right: 10rpx;' mode="">
					</image>
					一键拨号
				</view> -->
				
				<view class="id">{{item.inviteTime}}</view>
				<view class="type" :class="item.nodeState == 1?'green':''"
					v-if="item.nodeState == 2 || item.nodeState == 1">{{item.nodeState == 2?'被安置':'已安置'}}</view>
				</view>
			</view>
		</view>

		<!-- 成员信息 -->
		<view class="teamContent" v-if="type == 2">
			<view class="teamContent-title-content">
				<view>社区消费</view>
				<view class="span">
					<span class="span1">今日</span>
					<span>累计</span>
				</view>

			</view>
			<!-- 成员列表 -->
			<view class="teamList">
				<view class="list" v-for="(item,index) in list" :key="index" style="padding-bottom: 24rpx;">
					<!-- <image :src="item.avatar" class="hearder"></image>
					<view>
						<view class="name">
						    {{item.phone}}
						</view>
						<image src="@/static/bet/vip1.png" class="vip-img" v-if="item.level == 1"></image>
						<image src="@/static/bet/vip2.png" class="vip-img" v-if="item.level == 2"></image>
						<image src="@/static/bet/vip3.png" class="vip-img" v-if="item.level == 3"></image>
					</view>
					<view class="timeTeam">加入时间：{{item.inviteTime}}</view>
					<view class="nexts"><span>￥{{item.todayGroupBuy}}</span></view>
					<view class="next node"><span>￥{{item.totalAmount}}</span></view> -->
					<view class="userHeader">
						<image :src="item.avatar" class="hearder"></image>
						<image src="@/static/member/image12.png" class='memberVipIcon' v-if='item.isMember==0' mode="">
						</image>
						<image src="@/static/member/image13.png" class='memberVipIcon' v-if='item.isMember==1' mode="">
						</image>
						<image src="@/static/member/image14.png" class='memberVipIcon' v-if='item.isMember==2' mode="">
						</image>
					</view>
					<view>
						<view class="userInfoBox">
							<view class="tj_user">
								{{item.userName||'未命名'}}
							</view>
							<view :class="[item.todayHaveBuy=='0'?'todayHaveBuy1':'todayHaveBuy']">
								{{item.todayHaveBuy=='0'?'未参拍':'已参拍'}}
							</view>
						</view>
						<view class="tj_name">
							<span>ID:{{item.userId}}</span>
						</view>

						<image src="@/static/member/image6.png" v-if='item.trueLevel==0' class='vip-img' mode="">
						</image>
						<image src="@/static/member/image7.png" v-if='item.trueLevel==1' class='vip-img' mode="">
						</image>
						<image src="@/static/member/image8.png" v-if='item.trueLevel==2' class='vip-img' mode="">
						</image>
						<image src="@/static/member/image5.png" v-if='item.trueLevel==3' class='vip-img' mode="">
						</image>

						<image src="@/static/member/image2.png" v-if='item.groupLevel==0' class='vip-img' mode="">
						</image>
						<image src="@/static/member/image3.png" v-if='item.groupLevel==1' class='vip-img' mode="">
						</image>
						<image src="@/static/member/image4.png" v-if='item.groupLevel==2' class='vip-img' mode="">
						</image>
						<image src="@/static/member/image11.png" v-if='item.groupLevel>=3' class='vip-img' mode="">
						</image>
					</view>
					<!-- <view class="tell" @click='makePhoneCall(item.phone)'>
						<image src="@/static/statc-icon/tell-phone.png"
							style='width: 36rpx;height: 36rpx;margin-right: 10rpx;' mode="">
						</image>
						一键拨号
					</view> -->

					<view class="id">{{item.inviteTime}}</view>

					<view class="nexts"><span>{{jinwei(item.todayGroupBuy)}}</span></view>

					<view class="next node"><span>{{jinwei(item.totalAmount)}}</span></view>
				</view>
			</view>
		</view>

		<!-- 成员信息 -->
		<view class="teamContent" v-if="type == 3">
			<view class="teamContent-title-content">
				<view>消费为0客户</view>
				<view class="span">
					<span class="span1">今日新增</span>
					<span>累计</span>
				</view>

			</view>
			<!-- 成员列表 -->
			<view class="teamList">
				<view class="list" v-for="(item,index) in list" :key="index" style="padding-bottom: 24rpx;">
					<image :src="item.avatar" class="hearder"></image>
					<view>
						<view class="name">
							{{item.phone}}
						</view>
						<image src="@/static/bet/vip1.png" class="vip-img" v-if="item.level == 1"></image>
						<image src="@/static/bet/vip2.png" class="vip-img" v-if="item.level == 2"></image>
						<image src="@/static/bet/vip3.png" class="vip-img" v-if="item.level == 3"></image>
					</view>
					<view class="timeTeam">加入时间：{{item.inviteTime}}</view>
					<view class="nexts"><span>{{item.todayPersonalBuy}}</span></view>
					<view class="next node" style="color:#1A1A1A"><span>{{item.personalBuy}}</span></view>
				</view>
			</view>
		</view>

		<view class="noneContent" v-if="list.length == 0">
			<image src="../../static/withdraw/noneCard.png" class="noneImg"></image>
			<view class="tips">暂无数据</view>
		</view>

	</view>
</template>

<script>
	import {
		teamData,
		subUserPage
	} from '../../api/api.js'
	export default {
		data() {
			return {
				// 团队成员列表
				list: [],
				type: 1,
				pageNum: 1,
				pageSize: 20,
				pages: '',
				// 团队统计信息
				teamDataInfo: ''
			}
		},
		onLoad(e) {
			this.type = e.type
		},
		onShow() {
			this.pageNum = 1
			this.list = []
			// 获取我的团队成员列表
			this.getList()

		},
		onReachBottom() {
			if (this.pages <= this.pageNum) {
				uni.showToast({
					icon: 'none',
					title: '暂无更多~'
				})
				return
			} else {
				this.pageNum++
				// 获取我的团队成员列表
				this.getList()
			}
		},
		methods: {
			// 获取我的团队成员列表直推
			getList() {
				let data = {
					pageNum: this.pageNum,
					pageSize: this.pageSize,
					type: this.type
				}
				subUserPage(data).then(res => {
					this.list = this.list.concat(res.data.records)
					this.pages = res.data.pages
				})
			},
		}
	}
</script>

<style lang="less">
	.content {
		display: flex;
		align-items: center;
		flex-direction: column;

		// 团队统计信息
		.bannerContent {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			// justify-content: space-between;
			// padding: 0 60rpx;
			margin-top: 24rpx;
			width: 702rpx;
			height: 422rpx;
			background-image: url('../../static/bet/team-banner.png');
			background-size: cover;
			background-repeat: no-repeat;

			.bannerContent-item {
				width: 33%;
				display: flex;
				flex-direction: column;
				align-items: center;
			}

			.bannerContent-title {
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 26rpx;
				color: #FFFFFF;
				line-height: 28rpx;
				text-align: left;
				font-style: normal;
				text-transform: none;
			}

			.bannerContent-number {
				margin-top: 24rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 36rpx;
				color: #FFFFFF;
				line-height: 48rpx;
				text-align: left;
				font-style: normal;
				text-transform: none;
			}
		}

		// 成员信息
		.teamContent {
			margin-top: 24rpx;
			border-radius: 20rpx;
			overflow: hidden;

			.teamContent-title-content {
				padding: 0 24rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				width: 654rpx;
				height: 90rpx;
				background: #F4F8FF;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 30rpx;
				color: #1A1A1A;
				line-height: 30px;

				.span {
					color: #8A8A8A;
					font-size: 28rpx;

					.span1 {
						margin-right: 90rpx;
					}
				}
			}

			// 成员列表
			.teamList {
				border: 2rpx solid #F4F8FF;
				padding-bottom: 32rpx;
				display: flex;
				flex-direction: column;
				align-items: center;

				.list {
					margin-top: 30rpx;
					padding-bottom: 20rpx;
					width: 654rpx;
					position: relative;
					display: flex;
					align-items: center;
					border-bottom: 1rpx solid #F2F2F2;

					.userHeader {
						position: relative;
						display: flex;
						justify-content: center;
						margin-right: 24rpx;
						width: 128rpx;

						.hearder {
							width: 100rpx;
							height: 100rpx;
							border-radius: 50%;

						}

						.memberVipIcon {
							width: 128rpx;
							height: 56rpx;
							position: absolute;
							bottom: -10rpx;
							left: 0;
						}

					}

					.name {
						display: flex;
						align-items: center;
						font-size: 28rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #1A1A1A;
						line-height: 40rpx;

					}

					.vip-img {
						width: 134rpx;
						height: 28rpx;

						margin-right: 20rpx;
					}

					.level {
						margin-top: 12rpx;
						font-size: 26rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #999999;
						line-height: 37rpx;
					}

					.time {
						// position: absolute;
						left: 0;
						bottom: 20rpx;
						margin-top: 20rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: 400;
						font-size: 22rpx;
						color: #999999;
						line-height: 22rpx;
					}

					.timeTeam {
						// position: absolute;
						right: 0;
						bottom: 43rpx;
						margin-top: 20rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: 400;
						font-size: 22rpx;
						color: #999999;
						line-height: 22rpx;
					}

					.next {
						position: absolute;
						right: 0rpx;
						top: 10rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 28rpx;
						color: #000000;
						line-height: 26rpx;
						text-align: right;
						font-style: normal;
						text-transform: none;
					}

					.tell {
						width: 148rpx;
						height: 36rpx;
						background: #EAF2FF;
						border-radius: 18rpx;
						font-weight: 400;
						font-size: 24rpx;
						color: #4D96FF;

						box-sizing: border-box;
						position: absolute;
						right: 0rpx;
						top: 56rpx;
						display: flex;
						align-items: center;
						justify-content: center;

					}

					.nexts {
						position: absolute;
						right: 179rpx;
						top: 10rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: 400;
						font-size: 26rpx;
						color: #408FFF;
						line-height: 26rpx;
						text-align: right;
						font-style: normal;
						text-transform: none;
					}

					.id {
						position: absolute;
						right: 0rpx;
						bottom: 28rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: 400;
						font-size: 22rpx;
						color: #999999;
						line-height: 22rpx;
					}

					.type {
						position: absolute;
						right: 0rpx;
						bottom: 20rpx;
						width: 148rpx;
						height: 50rpx;
						background: #FFF3F3;
						border-radius: 100rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #FA2F30;
						line-height: 50rpx;
						text-align: center;
					}

					.green {
						background: #EEFDFD;
						color: #13C8D2;
					}

					.node {
						color: #FA2F30;
					}
				}

				.more {
					display: flex;
					align-items: center;
					justify-content: center;
					width: 654rpx;
					margin: 17rpx 0 0 0rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #408FFF;
					line-height: 24rpx;
				}
			}

			.noneContent {
				display: flex;
				align-items: center;
				flex-direction: column;

				.noneImg {
					margin-top: 132rpx;
					width: 320rpx;
					height: 291rpx;
				}

				.tips {
					margin-top: 36rpx;
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #B8B8B8;
					line-height: 33rpx;
				}
			}
		}

		.noneContent {
			display: flex;
			align-items: center;
			flex-direction: column;

			.noneImg {
				margin-top: 132rpx;
				width: 320rpx;
				height: 291rpx;
			}

			.tips {
				margin-top: 36rpx;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #B8B8B8;
				line-height: 33rpx;
			}
		}
	}
	
	.userInfoBox{
		display: flex;
		align-items: center;
		.todayHaveBuy{
			margin-left: 20rpx;
			font-weight: 400;
			font-size: 24rpx;
			color: #00C538;
			width: 112rpx;
			height: 40rpx;
			background: #EDFFF2;
			border-radius: 36rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}
		.todayHaveBuy1{
			margin-left: 20rpx;
			font-weight: 400;
			font-size: 24rpx;
			color: #FA2F30FF;
			width: 112rpx;
			height: 40rpx;
			background: #FFF3F3FF;
			border-radius: 36rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}
	}
</style>